package com.star.spring.my.service.config.drool;

import org.kie.api.KieServices;
import org.kie.api.builder.*;
import org.kie.api.runtime.KieContainer;
import org.kie.internal.io.ResourceFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DroolsConfig {
    // 制定规则文件的路径
    public static final String RULES_CUSTOMER_RULES_DRL = "rules/new.drl";
//    public static final String RULES_CUSTOMER_RULES_DRL = "rules/SensorRules.drl";
//    private static final KieServices kieServices = KieServices.Factory.get();


//    @Bean
//    public KieContainer kieContainer() {
//        KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
//        kieFileSystem.write(ResourceFactory.newClassPathResource(RULES_CUSTOMER_RULES_DRL));
//        KieBuilder kb = kieServices.newKieBuilder(kieFileSystem);
//        kb.buildAll();
//        KieModule kieModule = kb.getKieModule();
//        return kieServices.newKieContainer(kieModule.getReleaseId());
//    }


}
